package com.wyw.function.learning.common;

import lombok.Data;

/**
 * @Title
 * @Description
 * @Author Mr Wu yewen.wu.china@gmail.com
 * Update History:
 * Author        Time            Content
 */
@Data
public class Quote {

    private final String shopName;
    private final double price;
    private final Discount.CODE code;

    public static Quote parse(String s) {
        String[] split = s.split(":");
        String shopName = split[0];
        double price = Double.parseDouble(split[1]);
        Discount.CODE code = Discount.CODE.valueOf(split[2]);
        return new Quote(shopName, price, code);
    }
}

